package com.ctshk.sapp.guide.controller;


import com.ctshk.common.annotations.OperationLogAnnotation;
import com.ctshk.common.dto.Result;
import com.ctshk.common.enums.OperationLogModel;
import com.ctshk.common.enums.OperationLogType;
import com.ctshk.common.model.PageResponse;
import com.ctshk.rpc.guide.dto.TeaPartyDTO;
import com.ctshk.rpc.guide.req.*;
import com.ctshk.rpc.guide.service.IGuideCollarService;
import com.ctshk.rpc.guide.service.ITeaPartyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.*;

import com.ctshk.common.web.support.BaseController;

import javax.validation.Valid;

/**
 * <p>
 * 茶会管理表 前端控制器
 * </p>
 *
 * @author 谢诗宏
 * @since 2021-03-03
 */
@Api(value = "茶会管理",tags = "茶会管理")
@RestController
@RequestMapping("/tea/party")
public class TeaPartyController extends BaseController {


    @DubboReference
    private ITeaPartyService teaPartyService;

    @ApiOperation(value = "新增茶会信息", notes = "新增茶会信息")
    @OperationLogAnnotation(operModul = OperationLogModel.GUIDE, operType = OperationLogType.ADD, operTitle = "茶会信息", operDesc = "新增茶会信息")
    @PostMapping("/add")
    public Result add(@RequestBody @Valid TeaPartyAddReq req) {
        return teaPartyService.add(req,getCurrentUser(getRequest()));
    }


    @ApiOperation(value = "查询茶会信息", notes = "查询茶会信息")
    @OperationLogAnnotation(operModul = OperationLogModel.GUIDE, operType = OperationLogType.QUERY, operTitle = "查询", operDesc = "查询茶会信息")
    @PostMapping("/query")
    public Result<TeaPartyDTO> query(@RequestBody @Valid TeaPartyIdReq req) {
        return Result.success(teaPartyService.query(req));
    }

    @ApiOperation(value = "修改茶会信息主持人", notes = "修改茶会信息主持人")
    @OperationLogAnnotation(operModul = OperationLogModel.GUIDE, operType = OperationLogType.UPDATE, operTitle = "编辑", operDesc = "编辑茶会信息主持人")
    @PostMapping("/updateHost")
    public Result updateHost(@RequestBody @Valid TeaPartyHostUpdateReq req) {
        return teaPartyService.updateHost(req,getCurrentUser(getRequest()));
    }

    @ApiOperation(value = "修改茶会信息团状态", notes = "修改茶会信息团状态")
    @OperationLogAnnotation(operModul = OperationLogModel.GUIDE, operType = OperationLogType.UPDATE, operTitle = "编辑", operDesc = "修改茶会信息团状态")
    @PostMapping("/updateGroupStatus")
    public Result updateHost(@RequestBody @Valid TeaPartyGroupStatusUpdateReq req) {
        return teaPartyService.updateGroupStatus(req,getCurrentUser(getRequest()));
    }

    @ApiOperation(value = "查询茶会信息列表", notes = "查询茶会信息列表")
    @OperationLogAnnotation(operModul = OperationLogModel.GUIDE, operType = OperationLogType.QUERY, operTitle = "查询", operDesc = "查询茶会信息列表")
    @PostMapping("/list")
    public Result<PageResponse<TeaPartyDTO>> list(@RequestBody @Valid TeaPartyListReq req) {
        return Result.success(teaPartyService.list(req));
    }

    @ApiOperation(value = "删除主持人", notes = "删除主持人")
    @OperationLogAnnotation(operModul = OperationLogModel.GUIDE, operType = OperationLogType.UPDATE, operTitle = "编辑", operDesc = "删除茶会信息")
    @PostMapping("/delete")
    public Result delete(@RequestBody @Valid TeaPartyDeleteReq req) {
        return teaPartyService.delete(req,getCurrentUser(getRequest()));
    }

}
